package com.test24_国际化;

import org.junit.Test;

import java.util.Locale;

/**
 * Local，进行国家以及语言切换的控制类
 */
public class Demo01_Local {

    /**
     * 中国：language="zh"、country="CN"
     * 美国：language="en"、country="US"
     */
    @Test
    public void test1() {
        {
            Locale locale = new Locale("zn", "CN");
            System.out.println(locale);
        }
        {
            Locale locale = new Locale("en", "US");
            System.out.println(locale);
        }
    }

    @Test
    public void test2() {
        {
            // 获取当前默认的区域和语言实例
            Locale locale = Locale.getDefault();
            System.out.println(locale);
        }
        System.out.println("=======================");
        {
            // Local常量
            System.out.println(Locale.CHINA);
            System.out.println(Locale.US);
            System.out.println(Locale.ENGLISH);
            System.out.println(Locale.FRENCH);
        }
    }
}
